<%-- 
    Document   : registro
    Created on : Apr 13, 2010, 9:06:46 AM
    Author     : williamprado
--%>

<%
HttpSession currentSession = request.getSession();
java.util.List<businessObjects.Pais> paises = null;
paises = (java.util.List<businessObjects.Pais>) currentSession.getAttribute("listapaises");
if(currentSession.getAttribute("message")==null){
    currentSession.setAttribute("message", "");
}
%>

<script language="JavaScript" type="text/javascript">
function Validate(formulario){
            if(formulario.pass1.value == formulario.pass2.value){
                if(formulario.login.value != "" && formulario.pass1.value != "" && formulario.pass2.value != "" && formulario.nombre.value != "" && formulario.email.value != ""){
                    if(isNaN(formulario.login.value)){
                        if(isNaN(formulario.nombre.value)){
                            if(isNaN(formulario.email.value)){
                                if(formulario.ciudad.value == "" || isNaN(formulario.ciudad.value)){
                                    apos=formulario.email.value.indexOf("@");
                                    dotpos=formulario.email.value.lastIndexOf(".");
                                    if (apos>=1 && dotpos-apos>=2){
                                    formulario.password.value = hex_md5(formulario.pass1.value);                                    
                                    formulario.submit();
                                    }else{
                                        alert("El email no es valido.");
                                    }
                                }else{
                                    alert("La ciudad no puede ser un numero.");
                                }
                            }else{                                   
                                alert("El email no puede ser un numero.");
                            }
                        }else{                            
                                alert("El nombre no puede ser un numerico.");
                        }
                    }else{
                        alert("El login no puede ser un numero.");
                    }
                }else{
                    alert("Debe Llenar los campos marcados con (*).");
                }
            }else{
                alert("Los password ingresados no coinciden.");
            }
        }
</script>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Adz - Registro</title>
        <link href="css/adz.css" rel="stylesheet" type="text/css" />

        <script src="js/Encriptacion.js" type="text/javascript"></script>
    </head>
   <body bgcolor="#333333">
        <table border="0" width="1024" align="center" bgcolor="#FFFFFF">
        <tr>
            <td width="33%" align="left"><img src="images/adzlogo.jpg" alt="adz logo" width="75%" height="20%"></td>
            <td width="67%" align="center"><h2><strong>Sistema de Publicidad en Linea</strong></h2></td>
          </tr>
        
	<tr bgcolor="#FFFFFF"><td colspan="2">
	<div id="general" align="center">

	<div id="links" align="center">
    	<table width="100%" bgcolor="#999999">
            <tr align="center">
            	<td><form name="basic" method="post" action="verpautaFrontController">
                        <input name="action" type="hidden" value="tobasic">
                        <a style="cursor:pointer" onclick="document.basic.submit();">Ver Publicidad Basica</a></form></td>
                <td><form name="premium" method="post" action="FrontController">
                        <input name="action" type="hidden" value="topremium">
                        <a style="cursor:pointer" onclick="document.premium.submit();">Ver Publicidad Premium</a></form></td>
                <td><form name="reg" method="post" action="registroFrontController">
                        <input name="action" type="hidden" value="toreg">
                        <a style="cursor:pointer" onclick="document.reg.submit();">Registrarse</a></form></td>
                <td><a style="cursor:pointer" href="index.jsp">Volver al indice</a></td>
                <td><form name="pruebaWS" method="post" action="pruebaFC">
                        <input name="action" type="hidden" value="probarWS">
                        <a style="cursor:pointer" onclick="document.pruebaWS.submit();">Probar WS</a></form></td>               <td>01.05.2010 2:03 PM</td>
            </tr>
            
        </table>
	</div>

        <div id="content" align="center">
        
        <h1>Registrarse como cliente</h1>
        <p>Por favor, llene este formulario de registro :</p>


        <form name="formRegistro" action="registroFrontController" method="POST" onsubmit="Validate(document.formRegistro);">
        <TABLE BORDER=0>
            <TR><TD>*Login:</TD><TD><INPUT type="text" name="login" maxlength="20"></TD></TR>
        <TR><TD>*Password:</TD><TD><INPUT type="password" name="pass1"></TD></TR>
        <TR><TD>*Repetir password:</TD><TD><INPUT type="password" name="pass2"></TD></TR>
        <TR><TD>*Nombre Completo:</TD><TD><INPUT type="text" name="nombre" maxlength="45"></TD></TR>
        <TR><TD>*e-mail:</TD><TD><INPUT type="text" name="email" maxlength="45"></TD></TR>
        <TR><TD>*Pais:</TD><TD><SELECT name="pais"><%for(int i=0;i<paises.size();i++){%>
                                                    <option><%=paises.get(i).getCountry()%></option>
                                                  <%}%></SELECT></TD></TR>
        <TR><TD>Ciudad:</TD><TD><INPUT type="text" name="ciudad" maxlength="45"><input type="hidden" name="password"><input type="hidden" name="action" value="regNew"></TD></TR>
        <TR><TD COLSPAN=2 align="center"><INPUT type="submit" value="Enviar" style="cursor:pointer"><input type="reset" value="Limpiar Campos" style="cursor:pointer" /><input type="button" value="Regresar" style="cursor:pointer" onclick="document.location='index.jsp'"/></TD></TR>
        </TABLE>
        </form>
        <%=currentSession.getAttribute("message")%>

        </div>

        </td></tr>
    </table>

	<div id="footer" align="center">
	Adz - 2010 Copyright &copy; Todos los derechos reservados.</div>      
        
	</body>
</html>
